package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.aop.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

import static com.sky.enumeration.OperationType.UPDATE;

@Mapper
public interface SetmealMapper {

    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    Page<SetmealVO> getSetmea(SetmealPageQueryDTO setmealPageQueryDTO);


    void insert(Setmeal setmeal);

    /**
     * 批量删除
     * @param ids
     * @return
     */
    Integer getdelete(List<Long> ids);

    /**
     *
     * @param ids
     */
    void delete(List<Long> ids);

    /**
     * 根据id查询
     * @param build
     */
    void update(Setmeal build);

    @Select("select * from setmeal where id = #{id}")
    Setmeal getSetmealById(Long id);

}
